CREATE TABLE jms_dm.dm_end_center_error_scan_detail_dt (
                                                           center_code varchar(50) NULL COMMENT "中心编码",
                                                           agent_code varchar(50) NULL COMMENT "代理区编码",
                                                           is_misclass tinyint(4) NULL COMMENT "是否错分 1错分0非错分",
                                                           misclass_type int(11) NULL COMMENT "错分类型 0非错分 1二段码异常2上环节建包异常3设备异常4退回件5转寄件6中心发件做删除操作7人为因素",
                                                           ordersource_name varchar(100) NULL COMMENT "订单来源",
                                                           date_time date NULL COMMENT "查询日期",
                                                           agent_name varchar(100) NULL COMMENT "代理区名称",
                                                           waybill_no varchar(50) NULL COMMENT "运单号",
                                                           sign_time datetime NULL COMMENT "签收时间",
                                                           sign_site varchar(100) NULL COMMENT "签收网点",
                                                           sign_site_code varchar(50) NULL COMMENT "签收网点编码",
                                                           send_time datetime NULL COMMENT "装车发件时间    ",
                                                           center_name varchar(50) NULL COMMENT "中心名称   ",
                                                           scan_user varchar(100) NULL COMMENT "扫描人",
                                                           scan_user_code varchar(50) NULL COMMENT "扫描员工号",
                                                           send_source varchar(50) NULL COMMENT "中心发件扫描数据来源",
                                                           pistol_id varchar(50) NULL COMMENT "扫描设备编码",
                                                           next_station_code varchar(50) NULL COMMENT "发件下一站编码",
                                                           next_network_type int(11) NULL COMMENT "发件下一站类型",
                                                           package_code varchar(50) NULL COMMENT "包号",
                                                           first_code varchar(50) NULL COMMENT "一段码",
                                                           second_code varchar(50) NULL COMMENT "二段码",
                                                           third_code varchar(50) NULL COMMENT "三段码",
                                                           dispatch_network_code varchar(50) NULL COMMENT "运单二段码对应网点code",
                                                           dispatch_network varchar(100) NULL COMMENT "运单二段码对应网点",
                                                           taking_site_code varchar(50) NULL COMMENT "揽收网点编码",
                                                           taking_site varchar(100) NULL COMMENT "揽收网点name",
                                                           sign_cande_codes varchar(200) NULL COMMENT "签收网点可派货集散",
                                                           sencond_cande_codes varchar(200) NULL COMMENT "二段码可派货集散",
                                                           taking_cande_codes varchar(200) NULL COMMENT "揽收网点可派货集散",
                                                           package_number varchar(50) NULL COMMENT "集包编码",
                                                           apply_type_code int(11) NULL COMMENT "退回件类型 4退回,5转寄",
                                                           is_delete tinyint(4) NULL COMMENT "是否删除1是0否",
                                                           next_station varchar(100) NULL COMMENT "下一站名称",
                                                           sign_cande_names varchar(200) NULL COMMENT "签收网点可派货集散名称",
                                                           sencond_cande_names varchar(200) NULL COMMENT "二段码可派货集散",
                                                           taking_cande_names varchar(200) NULL COMMENT "揽收网点可派货集散",
                                                           virt_code varchar(50) NULL COMMENT "虚拟代理区code",
                                                           virt_name varchar(100) NULL COMMENT "虚拟代理区name",
                                                           provider_id varchar(50) NULL COMMENT "省份id",
                                                           provider_name varchar(100) NULL COMMENT "省份name",
                                                           unpackage_code varchar(50) NULL COMMENT "拆包网点编码",
                                                           unpackage_name varchar(100) NULL COMMENT "拆包网点名称"
) ENGINE=OLAP
DUPLICATE KEY(center_code, agent_code, is_misclass, misclass_type, ordersource_name)
COMMENT "错分率-明细"
PARTITION BY RANGE(date_time)(
   START ("2023-06-30") END ("2023-07-10") EVERY (INTERVAL 1 day))
DISTRIBUTED BY HASH(waybill_no) BUCKETS 16
PROPERTIES (
"replication_num" = "3",
"dynamic_partition.enable" = "true",
"dynamic_partition.time_unit" = "DAY",
"dynamic_partition.time_zone" = "Asia/Shanghai",
"dynamic_partition.start" = "-92",
"dynamic_partition.end" = "3",
"dynamic_partition.prefix" = "p",
"dynamic_partition.buckets" = "16",
"in_memory" = "false",
"storage_format" = "V2"
);

alter table jms_dm.dm_end_center_error_scan_detail_dt add column
(     bag_network_code varchar(50) comment'建包网点code'
     ,bag_network_name varchar(120) comment'建包网点name'
);